using System;
using Slaks.DocumentSerialization.Document.Wordnet;
using Slaks.Graphs;
using Slaks.Graphs.GraphBuilder;
using Slaks.Graphs.GraphBuilder.Wordnet;

namespace Slaks.Analysis.Mediators
{
	public class WordnetGraphBuilderMediator
	{
		public static void AddRepresentation()
		{
			WordnetGraphBuilderFactory.AddGraphBuilder(BuilderType.WordnetStandardRepresentation, new WordnetStandardRepresentation());
			WordnetGraphBuilderFactory.AddGraphBuilder(BuilderType.WordnetRawFrequencyRepresentation, new WordnetRawFrequencyRepresentation());
		}

		public static Graph BuildAdaptor(WordnetDocument document, IWordnetRepresentation representation, BuilderType builderType, int graphSize, int distanceValue)
		{
			Graph graph = null;

			if (builderType == BuilderType.WordnetStandardRepresentation || builderType == BuilderType.WordnetRawFrequencyRepresentation)
				graph = representation.Build(document, graphSize);
			
			else throw new Exception("BuildAdaptor : Only WordnetStandardRepresentation and WordnetRawFrequency are available");

			return graph;
		}
	}
}